package jay.home.bet.web.struts;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import jay.home.bet.domain.Event;
import jay.home.bet.misc.Util;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class UpdateGunqiuAction extends BaseAction 
{
	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response ) throws Exception
	{	
		String id = request.getParameter("id");
		Event event = getOddsService().getEvent(id);
		event.getDaxiao().setHome(Util.toDouble(request.getParameter("daxiao.home")));
		event.getDaxiao().setRoad(Util.toDouble(request.getParameter("daxiao.road")));
		event.getRangqiu().setHome(Util.toDouble(request.getParameter("rangqiu.home")));
		event.getRangqiu().setRoad(Util.toDouble(request.getParameter("rangqiu.road")));
		event.getComp().setNowResult(request.getParameter("nowResult"));
		getOddsService().updateEvent(event);
		getBasicService().updateComp(event.getComp());
		Map map = getOddsService().getCounter(event.getId());
		request.setAttribute("event", event);
		request.setAttribute("map", map);
		return mapping.findForward("SUCCESS");
	}
}
